<template>
  <div>
      <div class="diglog-wrap">
          <div class="dialog-cover" v-if="isShow" @click="closeMyself"></div>
          <transition name="drop">
            <div class="dialog-content" v-if="isShow">
                <p class="dialog-close" @click="closeMyself">x</p>
                <slot>empty</slot>
            </div>
          </transition>
      </div>
  </div>
</template>

<script>
export default {
  props:{
      isShow:{
          type: Boolean,
          default: false
      }
  },
  data(){
      return {}
  },
  methods:{
      closeMyself (){
          this.$emit('on-close')
      }
  }
}
</script>

<style scoped>
.drop-enter-active {
    transition: all .5s ease;
}

.drop-enter{
    transform: translateY(-600px)
}

.drop-leave-active{
    transition: all .5s ease;
    transform: translateY(-600px)    
}

.diglog-wrap{
    position: fixed;
    width: 100%;
    height: 100%;
}

.dialog-cover{
    position: fixed;
    z-index: 5;
    background-color: #000;
    opacity: .3;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.dialog-content {
    width: 50%;
    max-height: 50%;
    position: fixed;
    top: 20%;
    left: 50%;
    margin-left: -25%;
    /* transform: translateX(-50%); */
    background-color: #fff;
    z-index: 10;
    border: 2px solid #464068;
    padding: 2%;
    line-height: 1.6;
    overflow: auto;
}

.dialog-close{
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    text-align: center;
    cursor: pointer;
    font-weight: bold;
}

.dialog-close:hover {
  color: #4fc08d;
}
</style>

